package com.request; /**
 * @author wzm
 * @create 2023-03-06 9:45
 */

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.BufferedReader;
import java.io.IOException;

@WebServlet("/rs03")
public class RequestServlet03 extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

    }

    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

            //post请求才会携带请求体参数
        //字符输入流
        BufferedReader reader = request.getReader();
        //读取流中的数据
        String s = reader.readLine();
        System.out.println("s = " + s); //user=zs&pwd=123

        //如果以后要获取提交的二进制文件
        //ServletInputStream inputStream = request.getInputStream();

    }
}
